<script>
import bInput from './Items/bInput'
import bSelect from './Items/bSelect'
import bDatePicker from './Items/bDatePicker'
export default {
  functional:true,
  props:{
    formValue: {
      type: [Object, Number, String, Boolean, Array, undefined],
      default: () => undefined,
    },
    group: {
      type: String,
      default: '',
    },
    field: {
      type: String,
      default: '',
    },
    attr: {
      type: Object,
      default: () => {},
    },
  },
  render(h,ctx) {
    const props = ctx.props
    let bComponent
    switch (props.group){
      case 'bInput':
        bComponent = bInput
        break;
      case 'bSelect':
        bComponent = bSelect
        break;
      case 'bDatePicker':
        bComponent = bDatePicker
        break;
    }

    return h(bComponent, {
      props:{
        formValue:props.formValue,
        field:props.field
      },
      attrs:{...props.attr},
      on:{
        changeData(data){
          ctx.listeners.changeData(data)
        }
      }
    })
  }
}
</script>
